package com.zimin.cloud.system.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zimin.cloud.mine.pojo.system.view.MenuVO;
import com.zimin.cloud.system.pojo.entity.Menu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zimin.mapper.injector.InjectBaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 菜单权限 Mapper 接口
 * </p>
 *
 * @author zimin
 * @since 2021-12-30 11:05
 */
public interface MenuMapper extends InjectBaseMapper<Menu> {

    @Select("select  menu.* from  sys_role role " +
            "left join sys_role_menu roleMenu on role.id = roleMenu.role_id " +
            "left join sys_menu menu on menu.id = roleMenu.menu_id ${ew.customSqlSegment}")
    List<MenuVO> getMenuPermissionsByRoleIds(@Param(Constants.WRAPPER) QueryWrapper wrappers);
}
